package club.dmyang.service.impl;

import club.dmyang.dao.UserMapper;
import club.dmyang.entity.User;
import club.dmyang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by brss on 2018/6/29.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User queryUserById(Integer id) {
        User user = userMapper.selectByPrimaryKey(id);
        return user;
    }

    /**
     * 按照用户名name查询用户，并且联合查询，查出该用户的所有角色。
     * @param name
     * @return
     */
    @Override
    public User queryUserByName(String name) {
        User admin = userMapper.selectByName(name);
        return admin;
    }
}
